//
//  WSQAccountTool.h
//  WSQOCTools
//
//  Created by 翁胜琼 on 2019/1/19.
//  Copyright © 2019 Dev John. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "WSQAccount.h"

NS_ASSUME_NONNULL_BEGIN

// 网络请求类型
typedef NS_ENUM(NSUInteger, WSQHttpRequestMethod) {
    WSQHttpRequestMethodGET,
    WSQHttpRequestMethodPOST
};

@interface WSQAccountTool : NSObject


@property (nonatomic, readonly) WSQAccount *account;

+ (instancetype)shared;


- (void)removeAccount;
- (void)saveAccount:(WSQAccount *)account;
- (void)saveAccountWithDic:(NSDictionary *)dic;

// 获得当前账号


/**
 登录

 @param url 请求路径
 @param method 请求方式:GET/POST
 @param params 请求参数
 @param success 成功回调
 @param failure 失败回调
 */
+ (void)loginWithUrl:(NSString *)url
              method:(WSQHttpRequestMethod)method
              params:(NSDictionary *)params
             Success:(void (^)(id response))success
             failure:(void (^)(NSError *error, NSInteger statusCode))failure;


/**
 登出

 @param url 请求路径
 @param method 请求方式:GET/POST
 @param params 请求参数
 @param success 成功回调
 @param failure 失败回调
 */
+ (void)logoutWithUrl:(NSString *)url
               method:(WSQHttpRequestMethod)method
               params:(NSDictionary *)params
              Success:(void (^)(id response))success
              failure:(void (^)(NSError *error, NSInteger statusCode))failure;


/**
 重置密码

 @param url 请求路径
 @param method 请求方式:GET/POST
 @param params 请求参数
 @param success 成功回调
 @param failure 失败回调
 */
+ (void)resetPasswordWithUrl:(NSString *)url
                      method:(WSQHttpRequestMethod)method
                      params:(NSDictionary *)params
                     Success:(void (^)(id response))success
                     failure:(void (^)(NSError *error, NSInteger statusCode))failure;


@end

NS_ASSUME_NONNULL_END
